/*
ont-space - The ontology-based resource metadata repository
Copyright (c) 2006-2008, Information Eng. Research Unit - Univ. of Alcalá
http://www.cc.uah.es/ie
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package org.ontspace.util.translator.sld2owl.owl;

import org.w3c.dom.DOMException;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.datatypes.RDFDatatype;
import com.hp.hpl.jena.datatypes.TypeMapper;

/**
 *
 * This class translate the service element
 *     Too the sublclass of a Service can be:
 *         Conference
 *         Index-Search
 *         Send-Mail
 */
public class ServicesTranslator {

    lastInstanceSLDTranslator lastInst;

    /**
     * This method translate the send mail element
     *@param parent The parent class of the current element
     *@param node The send mail node of the Dom structure
     *@param ont The ontology
     *@param instLe The service instance
     *@param instEnvironment The environment instance
     *@param nsName The namespace
     */
    private void sendMail(OntClass parent, Node node, OntModel ont,
            Individual instLe, Individual instEnvironment, String nsName) {
        /**Method which creates a new instance of the send-mail class
         */
        DatatypeProperty identifier =
                ont.getDatatypeProperty(nsName + "identifier");
        DatatypeProperty title =
                ont.getDatatypeProperty(nsName + "title");
        DatatypeProperty visible =
                ont.getDatatypeProperty(nsName + "isvisible");
        DatatypeProperty select =
                ont.getDatatypeProperty(nsName + "select");
        DatatypeProperty classProperty =
                ont.getDatatypeProperty(nsName + "class");
        DatatypeProperty parameters =
                ont.getDatatypeProperty(nsName + "parameters");
        ObjectProperty roleRef =
                ont.getObjectProperty(nsName + "role-ref");


        NodeList Children =
                node.getChildNodes();

        if (Children != null) {
            lastInst =
                    new lastInstanceSLDTranslator();
            String instance =
                    "send_mail_instance_" +
                    (String.valueOf(lastInst.lastInstance(parent)));
            try {
                instLe =
                        ont.createIndividual(nsName + instance, parent);

                OntClass environment =
                        ont.getOntClass(nsName + "Environment");
                ObjectProperty serviceRef =
                        ont.getObjectProperty(nsName + "service-ref");

                instEnvironment.setPropertyValue(serviceRef, instLe);

                //service attributes
                Node serviceNode =
                        node.getParentNode();
                NamedNodeMap serviceItem =
                        serviceNode.getAttributes();
                for (int i =
                        0; i < serviceItem.getLength(); i++) {
                    Node attr =
                            serviceItem.item(i);
                    if (attr.getNodeName().trim().compareTo("identifier") == 0) {
                        TypeMapper tm =
                                TypeMapper.getInstance();
                        RDFDatatype overType =
                                tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                        RDFNode value =
                                ont.createTypedLiteral(attr.getNodeValue().trim(),
                                overType);
                        instLe.setPropertyValue(identifier, value);

                    }
                    if (attr.getNodeName().trim().compareTo("class") == 0) {
                        RDFNode classValue =
                                ont.createTypedLiteral(attr.getNodeValue().trim());
                        instLe.setPropertyValue(classProperty, classValue);
                    }
                    if (attr.getNodeName().trim().compareTo("isVisible") == 0) {
                        RDFNode visibleValue;
                        if (attr.getNodeValue().trim().compareTo("true") == 0) {
                            visibleValue =
                                    ont.createTypedLiteral(true);
                        } else {
                            visibleValue =
                                    ont.createTypedLiteral(false);
                        }

                        instLe.setPropertyValue(visible, visibleValue);

                    }
                    if (attr.getNodeName().trim().compareTo("parameters") == 0) {

                        RDFNode parametersValue =
                                ont.createTypedLiteral(attr.getNodeValue().trim());
                        instLe.setPropertyValue(parameters, parametersValue);
                    }
                }   //for



                for (int i =
                        0; i < Children.getLength(); i++) {
                    if (Children.item(i).getNodeName().compareTo("imsld:title") ==
                            0) {
                        RDFNode titleValue =
                                ont.createTypedLiteral(Children.item(i).
                                getTextContent());
                        instLe.setPropertyValue(title, titleValue);

                        NamedNodeMap attrsItem =
                                node.getAttributes();
                        for (int x =
                                0; x < attrsItem.getLength(); x++) {
                            Node attr =
                                    attrsItem.item(x);
                            if (attr.getNodeName().trim().compareTo("select") ==
                                    0) {
                                RDFNode selectValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim());
                                instLe.setPropertyValue(select, selectValue);
                            }
                        }//for
                    }

                    if (Children.item(i).getNodeName().
                            compareTo("imsld:email-data") == 0) {
                        NodeList rolerefl =
                                Children.item(i).getChildNodes();
                        for (int r =
                                0; r < rolerefl.getLength(); r++) {
                            if (rolerefl.item(r).getNodeName().
                                    compareTo("imsld:role-ref") == 0) {
                                NamedNodeMap attrsItem =
                                        rolerefl.item(r).getAttributes();
                                for (int x =
                                        0; x < attrsItem.getLength(); x++) {
                                    Node attr =
                                            attrsItem.item(x);
                                    if (attr.getNodeName().trim().
                                            compareTo("ref") == 0) {
                                        try {
                                            TypeMapper tm =
                                                    TypeMapper.getInstance();
                                            OntClass role =
                                                    ont.getOntClass(nsName +
                                                    "Role");
                                            RDFDatatype overType =
                                                    tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                                            RDFNode identifierValue =
                                                    ont.createTypedLiteral(attr.getNodeValue().
                                                    trim(), overType);
                                            searchInstance searchInst =
                                                    new searchInstance();
                                            Individual roleInst =
                                                    searchInst.search(role,
                                                    identifier, identifierValue);
                                            instLe.setPropertyValue(roleRef,
                                                    roleInst);

                                        } catch (DOMException ex) {
                                            ex.printStackTrace();
                                        } catch (Exception ex) {
                                            ex.printStackTrace();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }//for
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }//if
    }

    /**
     * This method translate the conference element
     *@param parent The parent class of the current element
     *@param node The conference node of the Dom structure
     *@param ont The ontology
     *@param instLe The service instance
     *@param instEnvironment The environment instance
     *@param nsName The namespace     
     */
    private void conference(OntClass parent, Node node, OntModel ont,
            Individual instLe,
            Individual instEnvironment, String nsName) {
        /**Method which creates a new instance of the conference class
         */
        OntClass participant =
                ont.getOntClass(nsName + "Participant");
        OntClass observer =
                ont.getOntClass(nsName + "Observer");
        OntClass conference =
                ont.getOntClass(nsName + "Conference");
        OntClass moderator =
                ont.getOntClass(nsName + "Moderator");

        DatatypeProperty identifier =
                ont.getDatatypeProperty(nsName + "identifier");
        DatatypeProperty identifierRef =
                ont.getDatatypeProperty(nsName + "identifier-ref");
        DatatypeProperty title =
                ont.getDatatypeProperty(nsName + "title");
        DatatypeProperty conferenceType =
                ont.getDatatypeProperty(nsName + "conference-type");
        ObjectProperty participantRef =
                ont.getObjectProperty(nsName + "participant-ref");
        ObjectProperty observerRef =
                ont.getObjectProperty(nsName + "observer-ref");
        ObjectProperty conferenceRef =
                ont.getObjectProperty(nsName + "conference-manager-ref");
        ObjectProperty moderatorRef =
                ont.getObjectProperty(nsName + "moderator-ref");
        DatatypeProperty isVisible =
                ont.getDatatypeProperty(nsName + "isvisible");
        DatatypeProperty classProperty =
                ont.getDatatypeProperty(nsName + "class");
        DatatypeProperty parameters =
                ont.getDatatypeProperty(nsName + "parameters");

        NodeList Children =
                node.getChildNodes();
        if (Children != null) {

            lastInst =
                    new lastInstanceSLDTranslator();
            String instance =
                    "conference_instance_" +
                    (String.valueOf(lastInst.lastInstance(parent)));
            try {
                instLe =
                        ont.createIndividual(nsName + instance, parent);
                ObjectProperty serviceRef =
                        ont.getObjectProperty(nsName + "service-ref");
                instEnvironment.setPropertyValue(serviceRef, instLe);

                Node serviceNode =
                        node.getParentNode();
                NamedNodeMap serviceItem =
                        serviceNode.getAttributes();
                for (int i =
                        0; i < serviceItem.getLength(); i++) {
                    Node attr =
                            serviceItem.item(i);
                    if (attr.getNodeName().trim().compareTo("identifier") == 0) {
                        TypeMapper tm =
                                TypeMapper.getInstance();
                        RDFDatatype overType =
                                tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                        RDFNode identifierValue =
                                ont.createTypedLiteral(attr.getNodeValue().trim(),
                                overType);
                        instLe.setPropertyValue(identifier, identifierValue);

                    }
                    if (attr.getNodeName().trim().compareTo("class") == 0) {
                        RDFNode classValue =
                                ont.createTypedLiteral(attr.getNodeValue().trim());
                        instLe.setPropertyValue(classProperty, classValue);

                    }
                    if (attr.getNodeName().trim().compareTo("isVisible") == 0) {
                        RDFNode visibleValue;
                        if (attr.getNodeValue().trim().compareTo("true") == 0) {
                            visibleValue =
                                    ont.createTypedLiteral(true);
                        } else {
                            visibleValue =
                                    ont.createTypedLiteral(false);
                        }

                        instLe.setPropertyValue(isVisible, visibleValue);
                    }
                    if (attr.getNodeName().trim().compareTo("parameters") == 0) {
                        RDFNode parametersValue =
                                ont.createTypedLiteral(attr.getNodeValue().trim());
                        instLe.setPropertyValue(parameters, parametersValue);

                    }
                }   //for
            } catch (Exception ex) {
                ex.printStackTrace();
            }

            for (int i =
                    0; i < Children.getLength(); i++) {
                if (Children.item(i).getNodeName().compareTo("imsld:title") == 0) {
                    String leTitle =
                            Children.item(i).getTextContent();
                    try {
                        RDFNode titleValue =
                                ont.createTypedLiteral(leTitle);
                        instLe.setPropertyValue(title, titleValue);

                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }

                    NamedNodeMap attrsItem =
                            node.getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        if (attr.getNodeName().trim().
                                compareTo("conference-type") == 0) {
                            try {
                                RDFNode conferenceValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim());
                                instLe.setPropertyValue(conferenceType,
                                        conferenceValue);

                            } catch (DOMException ex) {
                                ex.printStackTrace();
                            } catch (Exception ex) {
                                ex.printStackTrace();
                            }
                        }
                    }//for
                }

                if (Children.item(i).getNodeName().
                        compareTo("imsld:participant") == 0) {
                    NamedNodeMap attrsItem =
                            Children.item(i).getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        if (attr.getNodeName().trim().compareTo("role-ref") == 0) {
                            try {
                                TypeMapper tm =
                                        TypeMapper.getInstance();
                                RDFDatatype overType =
                                        tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                                RDFNode identifierValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim(), overType);
                                searchInstance searchInst =
                                        new searchInstance();
                                Individual participantInst =
                                        searchInst.search(participant,
                                        identifier, identifierValue);
                                instLe.setPropertyValue(participantRef,
                                        participantInst);

                            } catch (DOMException ex) {
                                ex.printStackTrace();
                            }
                        }
                    }//for
                }
                if (Children.item(i).getNodeName().
                        compareTo("imsld:observer") == 0) {
                    NamedNodeMap attrsItem =
                            Children.item(i).getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        if (attr.getNodeName().trim().
                                compareTo("role-ref") == 0) {
                            try {
                                TypeMapper tm =
                                        TypeMapper.getInstance();
                                RDFDatatype overType =
                                        tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                                RDFNode identifierValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim(), overType);
                                searchInstance searchInst =
                                        new searchInstance();
                                Individual observerInst =
                                        searchInst.search(observer, identifier,
                                        identifierValue);
                                instLe.setPropertyValue(observerRef,
                                        observerInst);

                            } catch (DOMException ex) {
                                ex.printStackTrace();
                            }
                        }
                    }//for
                }
                if (Children.item(i).getNodeName().
                        compareTo("imsld:conference-manager") == 0) {
                    NamedNodeMap attrsItem =
                            Children.item(i).getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        if (attr.getNodeName().trim().compareTo("role-ref") == 0) {
                            try {
                                TypeMapper tm =
                                        TypeMapper.getInstance();
                                RDFDatatype overType =
                                        tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                                RDFNode identifierValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim(), overType);
                                searchInstance searchInst =
                                        new searchInstance();
                                Individual conferenceInst =
                                        searchInst.search(conference, identifier,
                                        identifierValue);
                                instLe.setPropertyValue(conferenceRef,
                                        conferenceInst);

                            } catch (DOMException ex) {
                                ex.printStackTrace();
                            }
                        }
                    }//for
                }
                if (Children.item(i).getNodeName().
                        compareTo("imsld:moderator") == 0) {
                    NamedNodeMap attrsItem =
                            Children.item(i).getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        if (attr.getNodeName().trim().compareTo("role-ref") == 0) {
                            try {
                                TypeMapper tm =
                                        TypeMapper.getInstance();
                                RDFDatatype overType =
                                        tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                                RDFNode identifierValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim(), overType);
                                searchInstance searchInst =
                                        new searchInstance();
                                Individual moderatorInst =
                                        searchInst.search(moderator, identifier,
                                        identifierValue);
                                instLe.setPropertyValue(moderatorRef,
                                        moderatorInst);
                            } catch (DOMException ex) {
                                ex.printStackTrace();
                            }
                        }
                    }//for
                }
                if (Children.item(i).getNodeName().compareTo("imsld:item") == 0) {
                    NamedNodeMap attrsItem =
                            Children.item(i).getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        try {
                            if (attr.getNodeName().trim().
                                    compareTo("identifierref") == 0) {
                                RDFNode identifierRefValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim());
                                instLe.setPropertyValue(identifierRef,
                                        identifierRefValue);
                            }
                            if (attr.getNodeName().trim().
                                    compareTo("identifier") == 0) {
                                TypeMapper tm =
                                        TypeMapper.getInstance();
                                RDFDatatype overType =
                                        tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                                RDFNode identifierValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim(), overType);
                                instLe.setPropertyValue(identifier,
                                        identifierValue);
                            }
                            if (attr.getNodeName().trim().
                                    compareTo("isvisible") == 0) {
                                RDFNode isVisibleValue;
                                if (attr.getNodeValue().trim().compareTo("true") ==
                                        0) {
                                    isVisibleValue =
                                            ont.createTypedLiteral(true);
                                } else {
                                    isVisibleValue =
                                            ont.createTypedLiteral(false);
                                }

                                instLe.setPropertyValue(isVisible,
                                        isVisibleValue);
                            }

                        } catch (DOMException ex) {
                            ex.printStackTrace();
                        } catch (Exception ex) {
                            ex.printStackTrace();
                        }

                    }   //for
                }

            }//for
        }//if
    }

    /**
     * This method translate the index search element
     *@param parent The parent concept of the current element
     *@param node The index search node of the Dom structure
     *@param ont The ontology
     *@param instLe The service instance
     *@param instEnvironment The environment instance
     *@param nsName The namespace
     *
     */
    private void indexSearch(OntClass parent, Node node, OntModel ont,
            Individual instLe, Individual instEnvironment, String nsName) {
        /**Method which creates a new instance of the index-search classs
         */
        DatatypeProperty title =
                ont.getDatatypeProperty(nsName + "title");
        DatatypeProperty identifier =
                ont.getDatatypeProperty(nsName + "identifier");
        DatatypeProperty indexClass =
                ont.getDatatypeProperty(nsName + "index-class");
        DatatypeProperty isVisible =
                ont.getDatatypeProperty(nsName + "isvisible");
        DatatypeProperty parameters =
                ont.getDatatypeProperty(nsName + "parameters");
        DatatypeProperty searchType =
                ont.getDatatypeProperty(nsName + "search-type");
        DatatypeProperty indexTypeElement =
                ont.getDatatypeProperty(nsName + "index-type-of-element");
        DatatypeProperty indexElement =
                ont.getDatatypeProperty("index-element");


        NodeList Children =
                node.getChildNodes();
        if (Children != null) {
            for (int i =
                    0; i < Children.getLength(); i++) {
                lastInst =
                        new lastInstanceSLDTranslator();
                String instance =
                        "index_search_instance_" +
                        (String.valueOf(lastInst.lastInstance(parent)));
                try {
                    instLe =
                            ont.createIndividual(nsName + instance, parent);
//                    OntClass environment=ont.getOntClass(nsName+"Environment");                 
                    ObjectProperty serviceRef =
                            ont.getObjectProperty(nsName + "service-ref");
                    instEnvironment.setPropertyValue(serviceRef, instLe);

                    Node serviceNode =
                            node.getParentNode();

                    NamedNodeMap serviceItem =
                            serviceNode.getAttributes();
                    for (int s =
                            0; s < serviceItem.getLength(); s++) {
                        Node attr =
                                serviceItem.item(s);
                        if (attr.getNodeName().trim().compareTo("identifier") ==
                                0) {
                            TypeMapper tm =
                                    TypeMapper.getInstance();
                            RDFDatatype overType =
                                    tm.getSafeTypeByName("http://www.w3.org/2001/XMLSchema#ID");
                            RDFNode identifierValue =
                                    ont.createTypedLiteral(attr.getNodeValue().
                                    trim(), overType);
                            instLe.setPropertyValue(identifier, identifierValue);

                        }
                        if (attr.getNodeName().trim().compareTo("class") == 0) {
                            RDFNode indexClassValue =
                                    ont.createTypedLiteral(attr.getNodeValue().
                                    trim());
                            instLe.setPropertyValue(indexClass, indexClassValue);
                        }
                        if (attr.getNodeName().trim().compareTo("isVisible") ==
                                0) {
                            RDFNode isVisibleValue;
                            if (attr.getNodeValue().trim().compareTo("true") ==
                                    0) {
                                isVisibleValue =
                                        ont.createTypedLiteral(true);
                            } else {
                                isVisibleValue =
                                        ont.createTypedLiteral(false);
                            }

                            instLe.setPropertyValue(isVisible, isVisibleValue);
                        }
                        if (attr.getNodeName().trim().compareTo("parameters") ==
                                0) {
                            RDFNode parametersValue =
                                    ont.createTypedLiteral(attr.getNodeValue().
                                    trim());
                            instLe.setPropertyValue(parameters, parametersValue);
                        }
                    }   //for
                } catch (Exception ex) {
                    ex.printStackTrace();
                }

                if (Children.item(i).getNodeName().compareTo("imsld:title") == 0) {
                    String leTitle =
                            Children.item(i).getTextContent();
                    try {
                        RDFNode titleValue =
                                ont.createTypedLiteral(title, leTitle);
                        instLe.setPropertyValue(title, titleValue);

                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }

                }

                if (Children.item(i).getNodeName().compareTo("imsld:index") == 0) {
                    //Completar
                    NodeList indexChildren =
                            Children.item(i).getChildNodes();
                    if (indexChildren.item(i).getNodeName().compareTo(
                            "imsld:index-class") == 0) {
                        RDFNode indexClassValue =
                                ont.createTypedLiteral(indexChildren.item(i).
                                getNodeValue().trim());
                        instLe.setPropertyValue(indexClass, indexClassValue);
                    }

                    if (indexChildren.item(i).getNodeName().compareTo(
                            "imsld:index-element") == 0) {
                        NamedNodeMap attrsItem =
                                indexChildren.item(i).getAttributes();
                        for (int x =
                                0; x < attrsItem.getLength(); x++) {
                            Node attr =
                                    attrsItem.item(x);
                            if (attr.getNodeName().trim().compareTo("index") ==
                                    0) {
                                RDFNode indexElementValue =
                                        ont.createTypedLiteral(attr.getNodeValue().
                                        trim());
                                instLe.setPropertyValue(indexElement,
                                        indexElementValue);
                            }
                        }
                    }
                    if (indexChildren.item(i).getNodeName().compareTo(
                            "imsld:index-type-of-element") == 0) {
                        RDFNode indexTypeElementValue =
                                ont.createTypedLiteral(indexChildren.item(i).
                                getNodeValue().trim());
                        instLe.setPropertyValue(indexTypeElement,
                                indexTypeElementValue);
                    }

                }
                if (Children.item(i).getNodeName().compareTo("imsld:search") ==
                        0) {
                    NamedNodeMap attrsItem =
                            Children.item(i).getAttributes();
                    for (int x =
                            0; x < attrsItem.getLength(); x++) {
                        Node attr =
                                attrsItem.item(x);
                        if (attr.getNodeName().trim().compareTo("search-type") ==
                                0) {
                            RDFNode searchTypeValue =
                                    ont.createTypedLiteral(attr.getNodeValue().
                                    trim());
                            instLe.setPropertyValue(searchType, searchTypeValue);

                        }
                    }
                }
            }//for
        }//if
    }

    /**
     * Creates a new instance of ServicesTranslator
     * @param lnode The service node of the Dom structure
     * @param ont The ontology
     * @param instEnvironment The environment instance
     * @param nsName The namespace
     */
    public ServicesTranslator(Node lnode, OntModel ont,
            Individual instEnvironment, String nsName) {
        /** Creates a new instance of DomServices
        When the element reeded is a Dom Service creates a new instance
         * with its attributes
         */
        OntClass service =
                ont.getOntClass(nsName + "Service");
        OntClass sendMail =
                ont.getOntClass(nsName + "Send-Mail");
        OntClass conference =
                ont.getOntClass(nsName + "Conference");
        OntClass indexSearch =
                ont.getOntClass(nsName + "Index-Search");

        String ldTitle =
                "";
        Individual instLd =
                null;
        NamedNodeMap attrs =
                lnode.getAttributes();


        NodeList children =
                lnode.getChildNodes();
        if (children != null) {
            for (int i =
                    0; i < children.getLength(); i++) {
                if (children.item(i).getNodeName().compareTo("imsld:send-mail") ==
                        0) {
                    sendMail(sendMail, children.item(i), ont, instLd,
                            instEnvironment, nsName);

                }
                if (children.item(i).getNodeName().compareTo("imsld:conference") ==
                        0) {
                    conference(conference, children.item(i), ont, instLd,
                            instEnvironment, nsName);
                }
                if (children.item(i).getNodeName().compareTo("imsld:index-search") ==
                        0) {
                    indexSearch(indexSearch, children.item(i), ont, instLd,
                            instEnvironment, nsName);
                }
            }

        }






    }
}
